- Posts: 16
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Regex "/^\d+$/" accepts "." --- surely this is a bug?
- w0928
- Topic Author
- Offline
- New Member
Less
More
9 years 5 months ago - 9 years 5 months ago #115178
by w0928
Regex "/^\d+$/" accepts "." --- surely this is a bug? was created by w0928
LimeSurvey version 2.05+
Template: basic
Steps to reproduce:
1. Create a multiple-short text field.
2. In the validation enter "/^\d+$/" -- so that only numbers are accepted.
When you type anything other than a number into the box it will show the error right away... anything that is except for a period. If you type something like "55." it will appear to the user as valid but when you attempt to go to the next section you will get a message saying something was invalid on the screen. Meanwhile the user has no idea what you are talking about because the box doesn't show up pink/red.
I am aware of the multiple-numeric field. I can't use that because that has its own issues. Namely when you resume the survey it will always add ".0000000000" to the values if the user entered an integer in the box. There isn't a way to set "integer only" on that type of question for some reason. Also, if you put the same regex I mentioned above on a multiple-numeric field and the user resumes it will tack ".000000000" onto the end and cause the same situation where it complains about invalid input when you attempt to go to the next section (because its not an int) but there is no indication on the screen as to why.
Template: basic
Steps to reproduce:
1. Create a multiple-short text field.
2. In the validation enter "/^\d+$/" -- so that only numbers are accepted.
When you type anything other than a number into the box it will show the error right away... anything that is except for a period. If you type something like "55." it will appear to the user as valid but when you attempt to go to the next section you will get a message saying something was invalid on the screen. Meanwhile the user has no idea what you are talking about because the box doesn't show up pink/red.
I am aware of the multiple-numeric field. I can't use that because that has its own issues. Namely when you resume the survey it will always add ".0000000000" to the values if the user entered an integer in the box. There isn't a way to set "integer only" on that type of question for some reason. Also, if you put the same regex I mentioned above on a multiple-numeric field and the user resumes it will tack ".000000000" onto the end and cause the same situation where it complains about invalid input when you attempt to go to the next section (because its not an int) but there is no indication on the screen as to why.
Last edit: 9 years 5 months ago by w0928.
The topic has been locked.
- w0928
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
9 years 5 months ago - 9 years 5 months ago #115187
by w0928
Replied by w0928 on topic Regex "/^\d+$/" accepts "." --- surely this is a bug?
Also it will accept special characters, like Alt+523. It will actually accept those straight away but if you type anything after that it picks it up.
Last edit: 9 years 5 months ago by w0928.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13693
- Thank you received: 2501
9 years 5 months ago - 9 years 5 months ago #115199
by DenisChenu
And you can use something like is_int(this.NAOK) at em_validation_sq
If you think it's a bug, use the bug report system.
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Regex "/^\d+$/" accepts "." --- surely this is a bug?
I'm sure it's fixed in last version (last build).w0928 wrote: I am aware of the multiple-numeric field. I can't use that because that has its own issues. Namely when you resume the survey it will always add ".0000000000" to the values if the user entered an integer in the box.
And you can use something like is_int(this.NAOK) at em_validation_sq
If you think it's a bug, use the bug report system.
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 9 years 5 months ago by DenisChenu.
The following user(s) said Thank You: w0928
The topic has been locked.
- w0928
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
9 years 5 months ago #115204
by w0928
Replied by w0928 on topic Regex "/^\d+$/" accepts "." --- surely this is a bug?
Thanks. I will try the last build.
I did try is_int(this.NAOK) but it has the same issue as the regex.
I did try is_int(this.NAOK) but it has the same issue as the regex.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13693
- Thank you received: 2501
9 years 5 months ago #115205
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Regex "/^\d+$/" accepts "." --- surely this is a bug?
OK, great,
Then bug must be reported
Then bug must be reported
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.